{% extends 'base.html' %}
{% block title %}执行任务{% endblock %}
{% block content %}
    <form action="" method="post">
    {% csrf_token %}
        <div class="form-group">
            <ul class="nav nav-tabs">
                <li class="active"><a href="#server" data-toggle="tab">主机</a></li>
                <li><a href="#hostgroup" data-toggle="tab">主机组</a></li>
            </ul>
            <div class="tab-content" style="padding-top: 10px">
                <div class="tab-pane active fade in" id="server">
                    <select class="form-control" name="ip">
                            <option value="">无</option>
                        {% for host in hosts %}
                            <option value="{{ host.ipaddr }}">{{ host.hostname }}</option>
                        {% endfor %}
                    </select>
                </div>
                <div class="tab-pane fade" id="hostgroup">
                    <select class="form-control" name="group_name">
                            <option value="">无</option>
                        {% for group in groups %}
                            <option value="{{ group.group_name }}">{{ group.group_name }}</option>
                        {% endfor %}
                    </select>
                </div>
            </div>
        </div>
        <table class="table table-striped table-bordered table-hover">
        <tr class="info">
            <td>模块</td>
            <td>参数</td>
        </tr>
        {% for module in modules %}
            <tr>
                <td>
                    <div class="radio">
                        <label>
                            <input type="radio" name="module_name" value="{{ module.modlue_name }}">
                            {{ module.modlue_name }}
                        </label>
                    </div>
                </td>
                <td>
                    <ul class="list-unstyled">
                        {% for args in module.argument_set.all %}
                            <li>
                                <div class="radio">
                                    <label>
                                        <input type="radio" name="args" value="{{ args.arg_text }}">
                                        {{ args.arg_text }}
                                    </label>
                                </div>
                            </li>
                        {% endfor %}
                    </ul>
                </td>
            </tr>
        {% endfor %}
    </table>
    <div class="form-group text-center">
        <input class="btn btn-primary" type="submit" value="执 行">
    </div>
    </form>
{% endblock %}
